<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../../../static/layui-v2.6.8/layui/css/layui.css">
</head>

<div id="view"></div>


<script src="../../../static/layui-v2.6.8/layui/layui.js"></script>
<script>
layui.use('laytpl', function(){
  var laytpl = layui.laytpl;
layui.$(function(){

  layui.$.ajax({
    type:'get',
    url : 'getdraft',
    success:function(datas){
      layui.each(datas,function(datas){
        drafts = JSON.parse(datas)

        var data = { //数据
            "title":"Layui常用模块"
            ,"list":drafts
          }
          var getTpl = demo.innerHTML
          ,view = document.getElementById('view');
          layui.laytpl(getTpl).render(data, function(html){
            view.innerHTML = html;
          });

      })
    }
    
  })
})

}); 

</script>


<script id="demo" type="text/html">
  <fieldset class="layui-elem-field layui-field-title" >
      <legend>我的草稿</legend>
    </fieldset>
    <div class="layui-collapse" lay-filter="test">
    {{#  layui.each(d.list, function(index, item){ }}
      <div class="layui-colla-item">
        <h2 class="layui-colla-title">{{ item.title }}</h2>
        <div class="layui-colla-content">
          <p>{{ item.report }}</p>
        </div>
      </div>
      {{#  }); }}
      {{#  if(d.list.length === 0){ }}
        无数据
      {{#  } }} 
    </div>
</script>




</body>
</html>